<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateShopOrderActivityFeedbackTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('shop_order_activity_feedback', function (Blueprint $table) {
            $table->id();

            $table->unsignedBigInteger('activityId')->default(0)->comment('活动表 ID');
            $table->unsignedBigInteger('shopId')->default(0)->comment('活动门店');
            $table->string('shopName')->default(0)->comment('门店名称');
            $table->string('shopContact', 255)->default(0)->comment('门店联系方式');

            $table->text('feedback')->default('')->comment('活动反馈内容');
            $table->json('feedbackImages')->nullable()->comment('活动反馈图片');
            $table->json('feedbackVideos')->nullable()->comment('活动反馈视频');

            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('createdByUid')->default(0)->comment('创建人');
            $table->unsignedInteger('updatedAt')->default(0)->comment('修改时间');
            $table->unsignedInteger('updatedByUid')->default(0)->comment('修改人');
            $table->unsignedTinyInteger('isDeleted')->default(0)->comment('是否删除 0否 1 是');

            $table->index('activityId');
            $table->index('shopId');

            $table->index(['activityId', 'shopId']);

            $table->collation = 'utf8mb4_general_ci';
            $table->comment   = '门店订货活动反馈';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('shop_order_activity_feedback');
    }
}
